package com.designpattern.PrototypePattern;

import java.util.HashMap;

/**
 * @Author yue
 * @Date 2021-07-07
 * @Version V1.0.1
 * @Description
 */

public class ProtoTypeManager {

    private HashMap<String, Shape> ht = new HashMap<String, Shape>();
    public ProtoTypeManager() {
        ht.put("Circle", new Circle());
        ht.put("Square", new Square());
    }
    public void addshape(String key, Shape obj) {
        ht.put(key, obj);
    }
    public Shape getShape(String key) {
        Shape temp = ht.get(key);
        return (Shape) temp.clone();
    }

}
